<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>用户注册页面</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Minimal and Clean Sign up / Login and Forgot Form by
	FreeHTML5.co</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Free HTML5 Template by FreeHTML5.co" />
<meta name="keywords"
	content="free html5, free template, free bootstrap, html5, css3, mobile first, responsive" />




<!-- Facebook and Twitter integration -->
<meta property="og:title" content="" />
<meta property="og:image" content="" />
<meta property="og:url" content="" />
<meta property="og:site_name" content="" />
<meta property="og:description" content="" />
<meta name="twitter:title" content="" />
<meta name="twitter:image" content="" />
<meta name="twitter:url" content="" />
<meta name="twitter:card" content="" />

<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="shortcut icon" href="favicon.ico">

<link
	href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300'
	rel='stylesheet' type='text/css'>

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/login/css-login/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/login/css-login/animate.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/login/css-login/style.css">

<!-- Modernizr JS -->
<script
	src="${pageContext.request.contextPath}/login/js-login/modernizr-2.6.2.min.js"></script>
<!-- FOR IE9 below -->
<!--[if lt IE 9]>
	<script src="js/respond.min.js"></script>
	<![endif]-->
<style type="text/css">
body {
	background-image:
		url(${pageContext.request.contextPath}/login/images-login/geometry2.png);
}
</style>
</head>
<body class="style-2">

	<div class="container">
		<div class="row">
			<div class="col-md-12 text-center">
				<ul class="menu">
					<li><a href="doregist">注册用户</a></li>
					<li class="active"><a href="index-sign">注册商家</a></li>
					<li><a href="index-sign3">申请管理员</a></li>
				</ul>
			</div>
		</div>
		<div class="row">
			<div class="col-md-4">


				<!-- Start Sign In Form -->
				<form action="regist" class="fh5co-form animate-box" id="form1"
					data-animate-effect="fadeInLeft" onsubmit="return false"
					method="post">
					<h2>用户注册</h2>

					<div class="form-group">

						<input type="text" class="form-control" name="uname" id="u_name"
							placeholder="账户名" autocomplete="off">
					</div>
					<div class="form-group">

						<input type="password" class="form-control" name="upwd" id="u_pwd"
							placeholder="密码" autocomplete="off">
					</div>
					<div class="form-group">

						<input type="text" class="form-control" name="usex" id="u_sex"
							placeholder="性别" autocomplete="off">
					</div>
					<div class="form-group">

						<input type="text" class="form-control" name="utel" id="u_tel"
							placeholder="电话" autocomplete="off">
					</div>
					<div class="form-group">
						<label for="remember"><input type="checkbox" id="remember">
							Remember Me</label>
					</div>
					<div class="form-group">
						<p>
							已经有账号? <a href="dologin">立刻登录</a>
						</p>
					</div>
					<div class="form-group">
						<input type="button" value="登录" class="btn btn-primary"
							onclick="regist()">
					</div>
				</form>
				<!-- END Sign In Form -->


			</div>
		</div>

	</div>
	<script src="${pageContext.request.contextPath}/layui/layui.all.js"></script>

	<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<script type="text/javascript">
		function regist() {
			var utel = $("#u_tel").val();
			var upwd = $("#u_pwd").val();
			var upwd = $("#u_sex").val();
			var uname = $("#_uname").val();
			$.ajax({
				url : "regist",
				type : "post",
				data : $("#form1").serialize(),
				dataType : "json",
				success : function(data) {
					console.log(data);
					if (data.msg == "success") {

						layui.use('layer', function() {
							var layer = layui.layer;
							layer.msg('注册成功');

						});
						setTimeout("location.href='dologin'", 1000);
					} else {

						layui.use('layer', function() {
							var layer = layui.layer;
							layer.msg('请重新注册');
						});
						setTimeout("location.href='doregist'", 1000);
					}

				},
				error : function() {
					if (uname == "" || utel == "" || usex == "" || upwd == "") {

						layui.use('layer', function() {
							var layer = layui.layer;

							layer.msg('请重新输入');
						});
					}
					setTimeout("location.href='doregist'");
				}

			});

		}
	</script>


	<!-- jQuery -->
	<script
		src="${pageContext.request.contextPath}/login/js-login/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script
		src="${pageContext.request.contextPath}/login/js-login/bootstrap.min.js"></script>
	<!-- Placeholder -->
	<script
		src="${pageContext.request.contextPath}/login/js-login/jquery.placeholder.min.js"></script>
	<!-- Waypoints -->
	<script
		src="${pageContext.request.contextPath}/login/js-login/jquery.waypoints.min.js"></script>
	<!-- Main JS -->
	<script src="${pageContext.request.contextPath}/login/js-login/main.js"></script>

</body>
</html>